package com.pateo.springcloudgoods.web;

import com.pateo.springcloudgoods.web.request.GoodsRequest;
import com.pateo.springcloudgoods.web.response.GoodsResponse;
import com.pateo.springcloudgoods.web.response.PageResponse;
import com.pateo.springcloudgoods.web.response.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "商品管理接口")
public interface GoodsService {

    @ApiOperation(value = "新增商品信息", httpMethod = "POST", response = GoodsResponse.class, notes = "新增商品信息")
    @RequestMapping(value = "/addGoods",method = RequestMethod.POST)
     Response addGoods(GoodsRequest request);

    @ApiOperation(value = "修改商品信息", response = GoodsResponse.class, notes = "修改商品信息")
    @RequestMapping(value = "/updateGoods",method = RequestMethod.POST)
     Response updateGoods(GoodsRequest request);

    @ApiOperation(value = "查询所有商品列表", httpMethod = "GET", response = GoodsResponse.class, notes = "查询所有商品列表")
    @ApiParam(name = "sid", value = "商品id")
    @RequestMapping(value = "/queryAllGoods")
    List<GoodsResponse> queryAll();

    @ApiOperation(value = "分页查询所有商品列表", httpMethod = "GET", response = GoodsResponse.class, notes = "分页查询所有商品列表")
    @ApiParam(name = "sid", value = "商品id")
    @RequestMapping(value = "/queryPageGoods/{pageNumber}/{pageSize}")
    PageResponse<GoodsResponse> queryPage(@PathVariable("pageNumber") Integer pageNumber, @PathVariable("pageSize") Integer pageSize);

    @ApiOperation(value = "根据商品id获取商品信息", httpMethod = "GET", response = GoodsResponse.class, notes = "根据商品id获取商品信息")
    @ApiParam(name = "sid", value = "商品id")
    @RequestMapping(value = "/queryGoodsById/{id}")
    GoodsResponse queryGoods(@PathVariable("id") Long id);

    @ApiOperation(value = "根据商品id删除商品信息", httpMethod = "GET", response = GoodsResponse.class, notes = "根据商品id删除商品信息")
    @ApiParam(name = "sid", value = "商品id")
    @RequestMapping(value = "/deleteGoodsById/{id}",method = RequestMethod.GET)
     Response deleteGoodsById(@PathVariable("id") Long id);
}
